// Desc : Get the current foreground color as an int value. Currently this is only applicable in text mode, and the color value should be treated as a PC built-in color value. Here is a listing: 0=Black, 4=Red, 8=Dark gray, 12=Light red, 1=Blue, 5=Magenta, 9=Light blue, 13=Light magenta, 2=Green, 6=Brown, 10=Light green, 14=Yellow, 3=Cyan, 7=Light gray, 11=Light cyan, 15=White
return (sysCall_0(_fnum_textGetForeground));
}
_X_ static inline int textSetForeground(int foreground)
{
// Proto: int kernelTextSetForeground(int);
// Desc : Set the current foreground color from an int value. Currently this is only applicable in text mode, and the color value should be treated as a PC builtin color value. See chart above.
// Desc : Get the current background color as an int value. Currently this is only applicable in text mode, and the color value should be treated as a PC builtin color value. See chart above.
return (sysCall_0(_fnum_textGetBackground));
}
_X_ static inline int textSetBackground(int background)
{
// Proto: int kernelTextSetBackground(int);
// Desc : Set the current foreground color from an int value. Currently this is only applicable in text mode, and the color value should be treated as a PC builtin color value. See chart above.
// Desc : Set echo on (1) or off (0) for the specified input stream. When on, any characters typed will be automatically printed to the text area. When off, they won't.
// Desc : Set echo on (1) or off (0) for the default input stream. When on, any characters typed will be automatically printed to the text area. When off, they won't.
_X_ static inline int diskGetPartType(int code, partitionType *p)
{
// Proto: int kernelDiskGetPartType(int, partitionType *);
// Desc : Gets the partition type data for the corresponding code. This function was added specifically by use by programs such as 'fdisk' to get descriptions of different types known to the kernel.
// Desc : Like diskGetPartType(), but returns a pointer to a list of all known types. The memory is allocated dynamically and should be deallocated with a call to memoryRelease()
// Proto: int kernelDiskReadSectors(const char *, unsigned, unsigned, void *)
// Desc : Read 'count' sectors from disk 'name', starting at (zero-based) logical sector number 'sect'. Put the data in memory area 'buf'. This function requires supervisor privilege.
// Desc : Write 'count' sectors to disk 'name', starting at (zero-based) logical sector number 'sect'. Get the data from memory area 'buf'. This function requires supervisor privilege.
// Proto: int kernelDiskGetFilesystemType(const char *, char *, unsigned);
// Desc : This function attempts to explicitly detect the filesystem type on disk 'name', and copy up to 'bufSize' bytes of the filesystem type name into 'buf'. Particularly useful for things like removable media where the correct info may not be automatically provided in the disk structure.
// Desc : Format the logical volume 'theDisk', with a string 'type' representing the preferred filesystem type (for example, "fat", "fat16", "fat32, etc). Label it with 'label'. 'longFormat' will do a sector-by-sector format, if supported, and progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'. It is optional for filesystem drivers to implement this function.
_X_ static inline int filesystemCheck(const char *name, int force, int repair, progress *prog)
{
// Proto: int kernelFilesystemCheck(const char *, int, int, progress *)
// Desc : Check the filesystem on disk 'name'. If 'force' is non-zero, the filesystem will be checked regardless of whether the filesystem driver thinks it needs to be. If 'repair' is non-zero, the filesystem driver will attempt to repair any errors found. If 'repair' is zero, a non-zero return value may indicate that errors were found. If 'repair' is non-zero, a non-zero return value may indicate that errors were found but could not be fixed. Progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'. It is optional for filesystem drivers to implement this function.
_X_ static inline int filesystemDefragment(const char *name, progress *prog)
{
// Proto: int kernelFilesystemDefragment(const char *, progress *)
// Desc : Defragment the filesystem on disk 'name'. Progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'. It is optional for filesystem drivers to implement this function.
// Proto: int kernelFilesystemResizeConstraints(const char *, unsigned *, unsigned *);
// Desc : Get the minimum ('minBlocks') and maximum ('maxBlocks') number of blocks for a filesystem resize on disk 'name'. It is optional for filesystem drivers to implement this function.
// Proto: int kernelFilesystemResize(const char *, unsigned, progress *);
// Desc : Resize the filesystem on disk 'name' to the given number of blocks 'blocks'. Progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'. It is optional for filesystem drivers to implement this function.
_X_ static inline int filesystemMount(const char *name, const char *mp)
{
// Proto: int kernelFilesystemMount(const char *, const char *)
// Desc : Mount the filesystem on disk 'name', using the mount point specified by the absolute pathname 'mp'. Note that no file or directory called 'mp' should exist, as the mount function will expect to be able to create it.
_X_ static inline int fileFixupPath(const char *orig, char *new)
{
// Proto: int kernelFileFixupPath(const char *, char *);
// Desc : Take the absolute pathname in 'orig' and fix it up. This means eliminating extra file separator characters (for example) and resolving links or '.' or '..' components in the pathname.
// Proto: int kernelFileSeparateLast(const char *, char *, char *);
// Desc : This function will take a combined pathname/filename string and separate the two. The user will pass in the "combined" string along with two pre-allocated char arrays to hold the resulting separated elements.
_X_ static inline int fileNext(const char *path, file *f)
{
// Proto: int kernelFileNext(const char *, file *);
// Desc : Get the next file from the directory referenced by 'path'. 'f' should be a file structure previously filled by a call to either fileFirst() or fileNext().
_X_ static inline int fileOpen(const char *name, int mode, file *f)
{
// Proto: int kernelFileOpen(const char *, int, file *);
// Desc : Open the file referenced by 'name' using the file open mode 'mode' (defined in <sys/file.h>). Update the file data structure 'f' if successful.
// Desc : Read data from the previously opened file 'f'. 'f' should have been opened in a read or read/write mode. Read 'blocks' blocks (see the filesystem functions for information about getting the block size of a given filesystem) and put them in buffer 'buff'.
// Proto: int kernelFileWrite(file *, unsigned, unsigned, unsigned char *);
// Desc : Write data to the previously opened file 'f'. 'f' should have been opened in a write or read/write mode. Write 'blocks' blocks (see the filesystem functions for information about getting the block size of a given filesystem) from the buffer 'buff'.
_X_ static inline int fileCopyRecursive(const char *src, const char *dest)
{
// Proto: int kernelFileCopyRecursive(const char *, const char *);
// Desc : Recursively copy the file referenced by the pathname 'src' to the pathname 'dest'. If 'src' is a regular file, the result will be the same as using the non-recursive call. However if it is a directory, all contents of the directory and its subdirectories will be copied. This will overwrite any files in the 'dest' tree if they already exist.
// Desc : Create and open a temporary file in write mode.
return (sysCall_1(_fnum_fileGetTemp, f));
}
_X_ static inline int fileStreamOpen(const char *name, int mode, fileStream *f)
{
// Proto: int kernelFileStreamOpen(const char *, int, fileStream *);
// Desc : Open the file referenced by the pathname 'name' for streaming operations, using the open mode 'mode' (defined in <sys/file.h>). Fills the fileStream data structure 'f' with information needed for subsequent filestream operations.
// Desc : Return a pointer to a new block of memory of size 'size' and (optional) physical alignment 'align', adding the (optional) description 'desc'. If no specific alignment is required, use '0'. Memory allocated using this function is automatically cleared (like 'calloc').
// Desc : Return a pointer to a new physical block of memory of size 'size' and (optional) physical alignment 'align', adding the (optional) description 'desc'. If no specific alignment is required, use '0'. Memory allocated using this function is NOT automatically cleared. 'Physical' refers to an actual physical memory address, and is not necessarily useful to external programs.
// Desc : Release the memory block starting at the address 'p'. Must have been previously allocated using the memoryRequestBlock() function.
return (sysCall_1(_fnum_memoryRelease, p));
}
_X_ static inline int memoryReleaseAllByProcId(int pid)
{
// Proto: int kernelMemoryReleaseAllByProcId(int);
// Desc : Release all memory allocated to/by the process referenced by process ID 'pid'. Only privileged functions can release memory owned by other processes.
_X_ static inline int memoryChangeOwner(int opid, int npid, void *addr, void **naddr)
{
// Proto: int kernelMemoryChangeOwner(int, int, void *, void **);
// Desc : Change the ownership of an allocated block of memory beginning at address 'addr'. 'opid' is the process ID of the currently owning process, and 'npid' is the process ID of the intended new owner. 'naddr' is filled with the new address of the memory (since it changes address spaces in the process). Note that only a privileged process can change memory ownership.
_X_ static inline int memoryGetStats(memoryStats *stats, int kernel)
{
// Proto: int kernelMemoryGetStats(memoryStats *, int);
// Desc : Returns the current memory totals and usage values to the current output stream. If non-zero, the flag 'kernel' will return kernel heap statistics instead of overall system statistics.
_X_ static inline int memoryGetBlocks(memoryBlock *blocksArray, unsigned buffSize, int kernel)
{
// Proto: int kernelMemoryGetBlocks(memoryBlock *, unsigned, int);
// Desc : Returns a copy of the array of used memory blocks in 'blocksArray', up to 'buffSize' bytes. If non-zero, the flag 'kernel' will return kernel heap blocks instead of overall heap allocations.
_X_ static inline int multitaskerCreateProcess(const char *name, int privilege, processImage *execImage)
{
// Proto: int kernelMultitaskerCreateProcess(const char *, int, processImage *);
// Desc : Create a new process. 'name' will be the new process' name. 'privilege' is the privilege level. 'execImage' is a processImage structure that describes the loaded location of the file, the program's desired virtual address, entry point, size, etc. If the value returned by the call is a positive integer, the call was successful and the value is the new process' process ID. New processes are created and left in a stopped state, so if you want it to run you will need to set it to a running state ('ready', actually) using the function call multitaskerSetProcessState().
// Desc : Spawn a thread from the current process. The starting point of the code (for example, a function address) should be specified as 'addr'. 'name' will be the new thread's name. 'numargs' and 'args' will be passed as the "int argc, char *argv[]) parameters of the new thread. If there are no arguments, these should be 0 and NULL, respectively. If the value returned by the call is a positive integer, the call was successful and the value is the new thread's process ID. New threads are created and made runnable, so there is no need to change its state to activate it.
_X_ static inline int multitaskerProcessIsAlive(int pid)
{
// Proto: int kernelMultitaskerProcessIsAlive(int);
// Desc : Returns 1 if the process with the id 'pid' still exists and is in a 'runnable' (viable) state. Returns 0 if the process does not exist or is in a 'finished' state.
// Desc : Yield the remainder of the current processor timeslice back to the multitasker's scheduler. It's nice to do this when you are waiting for some event, so that your process is not 'hungry' (i.e. hogging processor cycles unnecessarily).
// Desc : Yield the remainder of the current processor timeslice back to the multitasker's scheduler, and wait at least 'ticks' timer ticks before running the calling process again. On the PC, one second is approximately 20 system timer ticks.
sysCall_1(_fnum_multitaskerWait, (void *) ticks);
}
_X_ static inline int multitaskerBlock(int pid)
{
// Proto: int kernelMultitaskerBlock(int);
// Desc : Yield the remainder of the current processor timeslice back to the multitasker's scheduler, and block on the process referenced by process ID 'pid'. This means that the calling process will not run again until process 'pid' has terminated. The return value of this function is the return value of process 'pid'.
// Desc : This allows a program to 'daemonize', detaching from the IO streams of its parent and, if applicable, the parent stops blocking. Useful for a process that want to operate in the background, or that doesn't want to be killed if its parent is killed.
return (sysCall_0(_fnum_multitaskerDetach));
}
_X_ static inline int multitaskerKillProcess(int pid, int force)
{
// Proto: int kernelMultitaskerKillProcess(int);
// Desc : Terminate the process referenced by process ID 'pid'. If 'force' is non-zero, the multitasker will attempt to ignore any errors and dismantle the process with extreme prejudice. The 'force' flag also has the necessary side effect of killing any child threads spawned by process 'pid'. (Otherwise, 'pid' is left in a stopped state until its threads have terminated normally).
// Desc : Load a file referenced by the pathname 'filename', and fill the file data structure 'theFile' with the details. The pointer returned points to the resulting file data.
// Desc : Given a file by the name 'fileName', the contents 'fileData', of size 'size', get the kernel loader's idea of the file type. If successful, the return value is non-NULL and the loaderFileClass structure 'class' is filled out with the known information.
// Desc : Like loaderClassify(), except the first argument 'fileName' is a file name to classify. Returns the kernel loader's idea of the file type. If successful, the return value is non-NULL and the loaderFileClass structure 'class' is filled out with the known information.
// Desc : Given a binary executable, library, or object file 'fileName' and a flag 'dynamic', return a loaderSymbolTable structure filled out with the loader symbols from the file. If 'dynamic' is non-zero, only symbols used in dynamic linking will be returned (if the file is not a dynamic library or executable, NULL will be returned). If 'dynamic' is zero, return all symbols found in the file.
_X_ static inline int loaderLoadProgram(const char *command, int privilege)
{
// Proto: int kernelLoaderLoadProgram(const char *, int);
// Desc : Run 'command' as a process with the privilege level 'privilege'. If successful, the call's return value is the process ID of the new process. The process is left in a stopped state and must be set to a running state explicitly using the multitasker function multitaskerSetProcessState() or the loader function loaderExecProgram().
_X_ static inline int loaderLoadLibrary(const char *libraryName)
{
// Proto: int kernelLoaderLoadLibrary(const char *);
// Desc : This takes the name of a library file 'libraryName' to load and creates a shared library in the kernel. This function is not especially useful to user programs, since normal shared library loading happens automatically as part of the 'loaderLoadProgram' process.
_X_ static inline int loaderExecProgram(int processId, int block)
{
// Proto: int kernelLoaderExecProgram(int, int);
// Desc : Execute the process referenced by process ID 'processId'. If 'block' is non-zero, the calling process will block until process 'pid' has terminated, and the return value of the call is the return value of process 'pid'.
// Desc : Get a random unsigned number between the start value 'start' and the end value 'end', inclusive, using the random seed 'seed' instead of the kernel's default random seed.
_X_ static inline int graphicGetMode(videoMode *mode)
{
// Proto: int kernelGraphicGetMode(videoMode *);
// Desc : Get the current video mode in 'mode'
return (sysCall_1(_fnum_graphicGetMode, mode));
}
_X_ static inline int graphicSetMode(videoMode *mode)
{
// Proto: int kernelGraphicSetMode(videoMode *);
// Desc : Set the video mode in 'mode'. Generally this will require a reboot in order to take effect.
return (sysCall_1(_fnum_graphicSetMode, mode));
}
_X_ static inline int graphicGetScreenWidth(void)
{
// Proto: int kernelGraphicGetScreenWidth(void);
// Desc : Returns the width of the graphics screen.
return (sysCall_0(_fnum_graphicGetScreenWidth));
}
_X_ static inline int graphicGetScreenHeight(void)
{
// Proto: int kernelGraphicGetScreenHeight(void);
// Desc : Returns the height of the graphics screen.
return (sysCall_0(_fnum_graphicGetScreenHeight));
}
_X_ static inline int graphicCalculateAreaBytes(int width, int height)
{
// Proto: int kernelGraphicCalculateAreaBytes(int, int);
// Desc : Returns the number of bytes required to allocate a graphic buffer of width 'width' and height 'height'. This is a function of the screen resolution, etc.
_X_ static inline int graphicGetColor(const char *colorName, color *getColor)
{
// Proto: int kernelGraphicGetColor(const char *, color *);
// Desc : Get the system color 'colorName' and place its values in the color structure 'getColor'. Examples of system color names include 'foreground', 'background', and 'desktop'.
_X_ static inline int graphicSetColor(const char *colorName, color *setColor)
{
// Proto: int kernelGraphicSetColor(const char *, color *);
// Desc : Set the system color 'colorName' to the values in the color structure 'getColor'. Examples of system color names include 'foreground', 'background', and 'desktop'.
_X_ static inline int graphicDrawPixel(objectKey buffer, color *foreground, drawMode mode, int xCoord, int yCoord)
{
// Proto: int kernelGraphicDrawPixel(kernelGraphicBuffer *, color *, drawMode, int, int);
// Desc : Draw a single pixel into the graphic buffer 'buffer', using the color 'foreground', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the X coordinate 'xCoord' and the Y coordinate 'yCoord'. If 'buffer' is NULL, draw directly onto the screen.
_X_ static inline int graphicDrawLine(objectKey buffer, color *foreground, drawMode mode, int startX, int startY, int endX, int endY)
{
// Proto: int kernelGraphicDrawLine(kernelGraphicBuffer *, color *, drawMode, int, int, int, int);
// Desc : Draw a line into the graphic buffer 'buffer', using the color 'foreground', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'startX', the starting Y coordinate 'startY', the ending X coordinate 'endX' and the ending Y coordinate 'endY'. At the time of writing, only horizontal and vertical lines are supported by the linear framebuffer graphic driver. If 'buffer' is NULL, draw directly onto the screen.
_X_ static inline int graphicDrawRect(objectKey buffer, color *foreground, drawMode mode, int xCoord, int yCoord, int width, int height, int thickness, int fill)
{
// Proto: int kernelGraphicDrawRect(kernelGraphicBuffer *, color *, drawMode, int, int, int, int, int, int);
// Desc : Draw a rectangle into the graphic buffer 'buffer', using the color 'foreground', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord', the width 'width', the height 'height', the line thickness 'thickness' and the fill value 'fill'. Non-zero fill value means fill the rectangle. If 'buffer' is NULL, draw directly onto the screen.
_X_ static inline int graphicDrawOval(objectKey buffer, color *foreground, drawMode mode, int xCoord, int yCoord, int width, int height, int thickness, int fill)
{
// Proto: int kernelGraphicDrawOval(kernelGraphicBuffer *, color *, drawMode, int, int, int, int, int, int);
// Desc : Draw an oval (circle, whatever) into the graphic buffer 'buffer', using the color 'foreground', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord', the width 'width', the height 'height', the line thickness 'thickness' and the fill value 'fill'. Non-zero fill value means fill the oval. If 'buffer' is NULL, draw directly onto the screen. Currently not supported by the linear framebuffer graphic driver.
_X_ static inline int graphicDrawImage(objectKey buffer, image *drawImage, drawMode mode, int xCoord, int yCoord, int xOffset, int yOffset, int width, int height)
// Desc : Draw the image 'drawImage' into the graphic buffer 'buffer', using the drawing mode 'mode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'xCoord' and the starting Y coordinate 'yCoord'. The 'xOffset' and 'yOffset' parameters specify an offset into the image to start the drawing (0, 0 to draw the whole image). Similarly the 'width' and 'height' parameters allow you to specify a portion of the image (0, 0 to draw the whole image -- minus any X or Y offsets from the previous parameters). So, for example, to draw only the middle pixel of a 3x3 image, you would specify xOffset=1, yOffset=1, width=1, height=1. If 'buffer' is NULL, draw directly onto the screen.
// Desc : Grab a new image 'getImage' from the graphic buffer 'buffer', using the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord', the width 'width' and the height 'height'. If 'buffer' is NULL, grab the image directly from the screen.
_X_ static inline int graphicDrawText(objectKey buffer, color *foreground, color *background, objectKey font, const char *text, drawMode mode, int xCoord, int yCoord)
{
// Proto: int kernelGraphicDrawText(kernelGraphicBuffer *, color *, color *, kernelAsciiFont *, const char *, drawMode, int, int);
// Desc : Draw the text string 'text' into the graphic buffer 'buffer', using the colors 'foreground' and 'background', the font 'font', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord'. If 'buffer' is NULL, draw directly onto the screen. If 'font' is NULL, use the default font.
// Desc : Within the graphic buffer 'buffer', copy the area bounded by ('xCoord1', 'yCoord1'), width 'width' and height 'height' to the starting X coordinate 'xCoord2' and the starting Y coordinate 'yCoord2'. If 'buffer' is NULL, copy directly to and from the screen.
_X_ static inline int graphicClearArea(objectKey buffer, color *background, int xCoord, int yCoord, int width, int height)
{
// Proto: int kernelGraphicClearArea(kernelGraphicBuffer *, color *, int, int, int, int);
// Desc : Clear the area of the graphic buffer 'buffer' using the background color 'background', using the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord', the width 'width' and the height 'height'. If 'buffer' is NULL, clear the area directly on the screen.
// Desc : Draw the clip of the buffer 'buffer' onto the screen. Draw it on the screen at starting X coordinate 'drawX' and starting Y coordinate 'drawY'. The buffer clip is bounded by the starting X coordinate 'clipX', the starting Y coordinate 'clipY', the width 'clipWidth' and the height 'clipHeight'. It is not legal for 'buffer' to be NULL in this case.
// Desc : Log the user into the window environment with 'userName'. The return value is the PID of the window shell for this session. The calling program must have supervisor privilege in order to use this function.
// Desc : Create a new window, owned by the process 'processId', and with the title 'title'. Returns an object key to reference the window, needed by most other window functions below (such as adding components to the window)
// Desc : Create a dialog window to associate with the parent window 'parent', using the supplied title. In the current implementation, dialog windows are modal, which is the main characteristic distinguishing them from regular windows.
_X_ static inline int windowSetHasBorder(objectKey window, int trueFalse)
{
// Proto: int kernelWindowSetHasBorder(kernelWindow *, int);
// Desc : Tells the windowing system whether to draw a border around the window 'window'. 'trueFalse' being non-zero means draw a border. Windows have borders by default.
_X_ static inline int windowSetHasTitleBar(objectKey window, int trueFalse)
{
// Proto: int kernelWindowSetHasTitleBar(kernelWindow *, int);
// Desc : Tells the windowing system whether to draw a title bar on the window 'window'. 'trueFalse' being non-zero means draw a title bar. Windows have title bars by default.
_X_ static inline int windowSetMovable(objectKey window, int trueFalse)
{
// Proto: int kernelWindowSetMovable(kernelWindow *, int);
// Desc : Tells the windowing system whether the window 'window' should be movable by the user (i.e. clicking and dragging it). 'trueFalse' being non-zero means the window is movable. Windows are movable by default.
_X_ static inline int windowSetResizable(objectKey window, int trueFalse)
{
// Proto: int kernelWindowSetResizable(kernelWindow *, int);
// Desc : Tells the windowing system whether to allow 'window' to be resized by the user. 'trueFalse' being non-zero means the window is resizable. Windows are resizable by default.
_X_ static inline int windowSetHasMinimizeButton(objectKey window, int trueFalse)
{
// Proto: int kernelWindowSetHasMinimizeButton(kernelWindow *, int);
// Desc : Tells the windowing system whether to draw a minimize button on the title bar of the window 'window'. 'trueFalse' being non-zero means draw a minimize button. Windows have minimize buttons by default, as long as they have a title bar. If there is no title bar, then this function has no effect.
_X_ static inline int windowSetHasCloseButton(objectKey window, int trueFalse)
{
// Proto: int kernelWindowSetHasCloseButton(kernelWindow *, int);
// Desc : Tells the windowing system whether to draw a close button on the title bar of the window 'window'. 'trueFalse' being non-zero means draw a close button. Windows have close buttons by default, as long as they have a title bar. If there is no title bar, then this function has no effect.
_X_ static inline int windowSetVisible(objectKey window, int visible)
{
// Proto: int kernelWindowSetVisible(kernelWindow *, int);
// Desc : Tell the windowing system whether to make 'window' visible or not. Non-zero 'visible' means make the window visible. When windows are created, they are not visible by default so you can add components, do layout, set the size, etc.
// Desc : Tell the windowing system whether to make 'window' minimized or not. Non-zero 'minimized' means make the window non-visible, but accessible via the task bar. Zero 'minimized' means restore a minimized window to its normal, visible size.
_X_ static inline int windowAddConsoleTextArea(objectKey window, componentParameters *params)
{
// Proto: int kernelWindowAddConsoleTextArea(kernelWindow *, componentParameters *);
// Desc : Add a console text area component to 'window' using the supplied componentParameters. The console text area is where most kernel logging and error messages are sent, particularly at boot time. Note that there is only one instance of the console text area, and thus it can only exist in one window at a time. Destroying the window is one way to free the console area to be used in another window.
// Desc : Tells the windowing system to redraw whatever is supposed to be in the screen area bounded by the supplied coordinates. This might be useful if you were drawing non-window-based things (i.e., things without their own independent graphics buffer) directly onto the screen and you wanted to restore an area to its original contents. For example, the mouse driver uses this method to erase the pointer from its previous position.
// Desc : Creates a window event using the supplied event structure. This function is most often used within the kernel, particularly in the mouse and keyboard functions, to signify clicks or key presses. It can, however, be used by external programs to create 'artificial' events. The windowEvent structure specifies the target component and event type.
sysCall_1(_fnum_windowProcessEvent, event);
}
_X_ static inline int windowComponentEventGet(objectKey key, windowEvent *event)
{
// Proto: int kernelWindowComponentEventGet(objectKey, windowEvent *);
// Desc : Gets a pending window event, if any, applicable to component 'key', and puts the data into the windowEvent structure 'event'. If an event was received, the function returns a positive, non-zero value (the actual value reflects the amount of raw data read from the component's event stream -- not particularly useful to an application). If the return value is zero, no event was pending.
_X_ static inline int windowScreenShot(image *saveImage)
{
// Proto: int kernelWindowScreenShot(image *);
// Desc : Get an image representation of the entire screen in the image data structure 'saveImage'. Note that it is not necessary to allocate memory for the data pointer of the image structure beforehand, as this is done automatically. You should, however, deallocate the data field of the image structure when you are finished with it.
_X_ static inline int windowSetTextOutput(objectKey key)
{
// Proto: int kernelWindowSetTextOutput(kernelWindowComponent *);
// Desc : Set the text output (and input) of the calling process to the object key of some window component, such as a TextArea or TextField component. You'll need to use this if you want to output text to one of these components or receive input from one.
_X_ static inline int windowComponentGetData(objectKey component, void *buffer, int size)
{
// Proto: int kernelWindowComponentGetData(kernelWindowComponent *, void *, int);
// Desc : This is a generic call to get data from the window component 'component', up to 'size' bytes, in the buffer 'buffer'. The size and type of data that a given component will return is totally dependent upon the type and implementation of the component.
_X_ static inline int windowComponentSetData(objectKey component, void *buffer, int size)
{
// Proto: int kernelWindowComponentSetData(kernelWindowComponent *, void *, int);
// Desc : This is a generic call to set data in the window component 'component', up to 'size' bytes, in the buffer 'buffer'. The size and type of data that a given component will use or accept is totally dependent upon the type and implementation of the component.
_X_ static inline int windowComponentGetSelected(objectKey component, int *selection)
{
// Proto: int kernelWindowComponentGetSelected(kernelWindowComponent *);
// Desc : This is a call to get the 'selected' value of the window component 'component'. The type of value returned depends upon the type of component; a list component, for example, will return the 0-based number(s) of its selected item(s). On the other hand, a boolean component such as a checkbox will return 1 if it is currently selected.
_X_ static inline int windowComponentSetSelected(objectKey component, int selected)
{
// Proto: int kernelWindowComponentSetSelected(kernelWindowComponent *, int);
// Desc : This is a call to set the 'selected' value of the window component 'component'. The type of value accepted depends upon the type of component; a list component, for example, will use the 0-based number to select one of its items. On the other hand, a boolean component such as a checkbox will clear itself if 'selected' is 0, and set itself otherwise.
// Desc : Get a new button component to be placed inside the parent object 'parent', with the given component parameters, and with the (optional) label 'label', or the (optional) image 'buttonImage'. Either 'label' or 'buttonImage' can be used, but not both.
// Desc : Get a new canvas component, to be placed inside the parent object 'parent', using the supplied width and height, with the given component parameters. Canvas components are areas which will allow drawing operations, for example to show line drawings or unique graphical elements.
// Desc : Get a new checkbox component, to be placed inside the parent object 'parent', using the accompanying text 'text', and with the given component parameters.
// Desc : Get a new container component, to be placed inside the parent object 'parent', using the name 'name', and with the given component parameters. Containers are useful for layout when a simple grid is not sufficient. Each container has its own internal grid layout (for components it contains) and external grid parameters for placing it inside a window or another container. Containers can be nested arbitrarily. This allows limitless control over a complex window layout.
// Desc : Get a new icon component to be placed inside the parent object 'parent', using the image data structure 'iconImage' and the label 'label', and with the given component parameters 'params'.
// Desc : Get a new image component to be placed inside the parent object 'parent', using the image data structure 'baseImage', and with the given component parameters 'params'.
_X_ static inline objectKey windowNewList(objectKey parent, windowListType type, int rows, int columns, int multiple, listItemParameters *items, int numItems, componentParameters *params)
// Desc : Get a new window list component to be placed inside the parent object 'parent', using the component parameters 'params'. 'type' specifies the type of list (see <sys/window.h> for possibilities), 'rows' and 'columns' specify the size of the list and layout of the list items, 'multiple' allows multiple selections if non-zero, and 'items' is an array of 'numItems' list item parameters.
// Desc : Get a new list item component to be placed inside the parent object 'parent', using the list item parameters 'item', and the component parameters 'params'.
// Desc : Get a new menu component to be placed inside the parent object 'parent', using the name 'name' (which will be the header of the menu) and the component parameters 'params', and with the given component parameters 'params'. A menu component is an instance of a container, typically contains menu item components, and is typically added to a menu bar component.
// Desc : Get a new menu bar component to be placed inside the parent object 'parent', using the component parameters 'params'. A menu bar component is an instance of a container, and typically contains menu components.
// Desc : Get a new menu item component to be placed inside the parent object 'parent', using the string 'text' and the component parameters 'params'. A menu item component is typically added to menu components, which are in turn added to menu bar components.
// Desc : Get a new password field component to be placed inside the parent object 'parent', using 'columns' columns and the component parameters 'params'. A password field component is a special case of a text field component, and behaves the same way except that typed characters are shown as asterisks (*).
// Desc : Get a new progress bar component to be placed inside the parent object 'parent', using the component parameters 'params'. Use the windowComponentSetData() function to set the percentage of progress.
// Desc : Get a new radio button component to be placed inside the parent object 'parent', using the component parameters 'params'. 'rows' and 'columns' specify the size and layout of the items, and 'numItems' specifies the number of strings in the array 'items', which specifies the different radio button choices. The windowComponentSetSelected() and windowComponentGetSelected() functions can be used to get and set the selected item (numbered from zero, in the order they were supplied in 'items').
// Desc : Get a new scroll bar component to be placed inside the parent object 'parent', with the scroll bar type 'type', and the given component parameters 'params'.
// Desc : Get a new text area component to be placed inside the parent object 'parent', with the given component parameters 'params'. The 'columns' and 'rows' are the visible portion, and 'bufferLines' is the number of extra lines of scrollback memory. If 'font' is NULL, the default font will be used.
// Desc : Get a new text field component to be placed inside the parent object 'parent', using the number of columns 'columns' and with the given component parameters 'params'. Text field components are essentially 1-line 'text area' components. If the params 'font' is NULL, the default font will be used.
// Desc : Get a new text labelComponent to be placed inside the parent object 'parent', with the given component parameters 'params', and using the text string 'text'. If the params 'font' is NULL, the default font will be used.
_X_ static inline int userLogout(const char *name)
{
// Proto: int kernelUserLogout(const char *);
// Desc : Log the user 'name' out of the system. This can only be called by a process with supervisor privilege, or one running as the same user being logged out.
// Desc : Set the password of user 'name'. If the calling program is not supervisor privilege, the correct old password must be supplied in 'oldPass'. The new password is supplied in 'newPass'.
// Desc : Get the process ID of the current user's 'login process'.
return (sysCall_0(_fnum_userGetPid));
}
_X_ static inline int userSetPid(const char *name, int pid)
{
// Proto: int kernelUserSetPid(const char *, int);
// Desc : Set the login PID of user 'name' to 'pid'. This is the process that gets killed when the user indicates that they want to logout. In graphical mode this will typically be the PID of the window shell pid, and in text mode it will be the PID of the login VSH shell.
// Desc : Set the password of user 'userName' in the designated password file. If the calling program is not supervisor privilege, the correct old password must be supplied in 'oldPass'. The new password is supplied in 'newPass'.
// Desc: Opens a connection for network communication. The 'type' and 'mode' arguments describe the kind of connection to make (see possiblilities in the file <sys/network.h>. If applicable, 'address' specifies the network address of the remote host to connect to. If applicable, the 'localPort' and 'remotePort' arguments specify the TCP/UDP ports to use.
// Proto: int kernelNetworkRead(kernelNetworkConnection *, unsigned char *, unsigned);
// Desc: Given a network connection, a buffer, and a buffer size, read up to 'bufferSize' bytes (or the number of bytes available in the connection's input stream) and return the number read. The connection must be initiated using the networkConnectionOpen() function.
// Proto: int kernelNetworkWrite(kernelNetworkConnection *, unsigned char *, unsigned);
// Desc: Given a network connection, a buffer, and a buffer size, write up to 'bufferSize' bytes from 'buffer' to the connection's output. The connection must be initiated using the networkConnectionOpen() function.
_X_ static inline int networkPing(objectKey connection, int seqNum, unsigned char *buffer, unsigned bufferSize)
{
// Proto: int kernelNetworkPing(kernelNetworkConnection *, int, unsigned char *, unsigned);
// Desc: Send an ICMP "echo request" packet to the host at the network address 'destAddress', with the (optional) sequence number 'seqNum'. The 'buffer' and 'bufferSize' arguments point to the location of data to send in the ping packet. The content of the data is mostly irrelevant, except that it can be checked to ensure the same data is returned by the ping reply from the remote host.
_X_ static inline int fontSetDefault(const char *name)
{
// Proto: int kernelFontSetDefault(const char *);
// Desc : Set the default font for the system to the font with the name 'name'. The font must previously have been loaded by the system, for example using the fontLoad() function.
_X_ static inline int fontLoad(const char* filename, const char *fontname, objectKey *pointer, int fixedWidth)
{
// Proto: int kernelFontLoad(const char*, const char*, kernelAsciiFont **, int);
// Desc : Load the font from the font file 'filename', give it the font name 'fontname' for future reference, and return an object key for the font in 'pointer' if successful. The integer 'fixedWidth' argument should be non-zero if you want each character of the font to have uniform width (i.e. an 'i' character will be padded with empty space so that it takes up the same width as, for example, a 'W' character).
_X_ static inline int fontGetPrintedWidth(objectKey font, const char *string)
{
// Proto: int kernelFontGetPrintedWidth(kernelAsciiFont *, const char *);
// Desc : Given the supplied string, return the screen width that the text will consume given the font 'font'. Useful for placing text when using a variable-width font, but not very useful otherwise.
_X_ static inline int imageLoad(const char *filename, int width, int height, image *loadImage)
{
// Proto: int imageLoad(const char *, int, int, image *);
// Desc : Try to load the bitmap image file 'filename' (with the specified 'width' and 'height' if possible -- zeros indicate no preference), and if successful, save the data in the image data structure 'loadImage'.
_X_ static inline int imageSave(const char *filename, int format, image *saveImage)
{
// Proto: int imageSave(const char *, int, image *);
// Desc : Save the image data structure 'saveImage' using the image format 'format' to the file 'fileName'. Image format codes are found in the file <sys/image.h>
return (sysCall_3(_fnum_imageSave, (void *) filename, (void *) format,
saveImage));
}
_X_ static inline int shutdown(int reboot, int nice)
{
// Proto: int kernelShutdown(int, int);
// Desc : Shut down the system. If 'reboot' is non-zero, the system will reboot. If 'nice' is zero, the shutdown will be orderly and will abort if serious errors are detected. If 'nice' is non-zero, the system will go down like a kamikaze regardless of errors.
// Desc : Verify that a lock on the lock structure 'verLock' is still valid. This can be useful for retrying a lock attempt if a previous one failed; if the process that was previously holding the lock has failed, this will release the lock.
_X_ static inline int configurationReader(const char *fileName, variableList *list)
{
// Proto: int kernelConfigurationReader(const char *, variableList *);
// Desc : Read the contents of the configuration file 'fileName', and return the data in the variable list structure 'list'. Configuration files are simple properties files, consisting of lines of the format "variable=value"
_X_ static inline int configurationWriter(const char *fileName, variableList *list)
{
// Proto: int kernelConfigurationWriter(const char *, variableList *);
// Desc : Write the contents of the variable list 'list' to the configuration file 'fileName'. Configuration files are simple properties files, consisting of lines of the format "variable=value". If the configuration file already exists, the configuration writer will attempt to preserve comment lines (beginning with '#') and formatting whitespace.
_X_ static inline int keyboardGetMaps(char *buffer, unsigned size)
{
// Proto: int kernelKeyboardGetMaps(char *, unsigned);
// Desc : Get a listing of the names of all available keyboard mappings. The buffer is filled up to 'size' bytes with descriptive names, such as "English (UK)". Each string is NULL-terminated, and the return value of the call is the number of strings copied. The first string returned is the current map.
_X_ static inline int keyboardSetMap(const char *name)
{
// Proto: int kernelKeyboardSetMap(const char *);
// Desc : Set the keyboard mapping to the supplied 'name'. The normal procedure would be to first call the keyboardGetMaps() function, get the list of supported mappings, and then call this function with one of those names. Only a name returned by the keyboardGetMaps function is valid in this scenario.
_X_ static inline int mouseSwitchPointer(const char *pointerName)
{
// Proto: int kernelMouseSwitchPointer(const char *)
// Desc : Tells the mouse driver code to switch to the mouse pointer with the given name (as specified by the pointer name argument to mouseLoadPointer).